 

import { ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useTaskNodeStore } from '@/store/project/task-node'
import type { IJsonItem } from '../types'

export function usePreTasks(): IJsonItem {
  const { t } = useI18n()
  const taskStore = useTaskNodeStore()
  const options = ref(taskStore.getPreTaskOptions)

  watch(
    () => taskStore.getPreTaskOptions,
    (value) => {
      options.value = value
    }
  )

  return {
    type: 'select',
    field: 'preTasks',
    span: 24,
    class: 'pre-tasks-model',
    name: t('project.node.pre_tasks'),
    props: {
      multiple: true,
      filterable: true
    },
    options
  }
}
